<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core">
  


  <ui:composition>
 
     <script >
     
      //<![CDATA[
      function mascaraTexto(evento, mascara){

    var campo, valor, i, tam, caracter;

    if (document.all) // Internet Explorer
       campo = evento.srcElement;
    else // Nestcape, Mozzila
        campo= evento.target;

    valor = campo.value;
    tam = valor.length;

    for(i=0;i<mascara.length;i++){
       caracter = mascara.charAt(i);
       if(caracter!="9")
          if(i<tam & caracter!=valor.charAt(i))
             campo.value = valor.substring(0,i) + caracter + valor.substring(i,tam);


    }

 }
       

        //]]>
    </script>

 <!-- importante que os parametros tenham os mesmo nomes das tags default do jsf ...  -->
 <h:inputText id="#{id}" value="#{value}" maxlength="14" size="14" onkeyup="mascaraTexto(event,'999.999.999-99')">

    </h:inputText>
  </ui:composition>

</html>

